package main
import (
	"flag"
	"fmt"
	"os"
)



type Cmd struct{
	helpFlag bool
	versionFlag bool
	cpOption string
	XjreOption string
	class string
	args []string
}


func parseCmd() *Cmd  {
	cmd := &Cmd{};
	//打印输出的信息
	flag.Usage = printUsage
	flag.BoolVar(&cmd.helpFlag,"help",false,"this is help message");
	flag.BoolVar(&cmd.helpFlag,"?",false,"this is help message ?");
	flag.BoolVar(&cmd.versionFlag,"version",false,"print version and exit");
	flag.StringVar(&cmd.cpOption,"classpath","","classpath");
	flag.StringVar(&cmd.cpOption,"cp","","classpath");
	flag.StringVar(&cmd.XjreOption,"Xjre","","ath to jre")
	flag.Parse();
	args := flag.Args()
	if len(args) > 0{
		cmd.class = args[0]
		cmd.args = args[1:]
	}
	fmt.Printf("cp=%s",cmd.cpOption);
	return cmd;
}
func printUsage(){
	fmt.Printf("Usage: %s [-options] class [args...] \n",os.Args[0]);
}